From: Jonas Dreßler Date: Sat, 13 Feb 2021 15:16:20 +0000 (+0100) Subject: main: Only restore key focus on pop when modal actor is still focused X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~76 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4d544d7b5614cd33bf60c1b610f8b81546955fbb;p=gnome-shell.git main: Only restore key focus on pop when modal actor is still focused If something grabs the key focus while a modal is pushed, keeping key-focus on that actor seems like the smarter thing to do than setting it back to the last focus after the modal gets popped again. So check if the key focus actor that we set when pushing the modal got changed when popping that modal, and if it got changed, simply don't touch key focus. This fixes a bug with the close dialog, where key focus isn't correctly set to the dialog after alt-tabbing to a window showing a close dialog. Part-of: --- diff --git a/js/ui/main.js b/js/ui/main.js index 4ba3faa8c..23e36aba5 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -755,7 +755,8 @@ export function popModal(grab, timestamp) { if (record.prevFocus) record.prevFocus.disconnect(record.prevFocusDestroyId); actionMode = record.actionMode; - global.stage.set_key_focus(record.prevFocus); + if (global.stage.key_focus === record.actor) + global.stage.set_key_focus(record.prevFocus); } else { // If we have: // global.stage.set_focus(a);